#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<queue>
#include<stack>

using namespace std;

#include"priority_queue.h"

namespace zkz
{

	class Date
	{
	public:
		Date(int year = 1900, int month = 1, int day = 1)
			: _year(year)
			, _month(month)
			, _day(day)
		{}

		bool operator<(const Date& d)const
		{
			return (_year < d._year) ||
				(_year == d._year && _month < d._month) ||
				(_year == d._year && _month == d._month && _day < d._day);
		}

		bool operator>(const Date& d)const
		{
			return (_year > d._year) ||
				(_year == d._year && _month > d._month) ||
				(_year == d._year && _month == d._month && _day > d._day);
		}

		friend ostream& operator<<(ostream& _cout, const Date& d);
	private:
		int _year;
		int _month;
		int _day;
	};

	ostream& operator<<(ostream& _cout, const Date& d)
	{
		_cout << d._year << "-" << d._month << "-" << d._day;
		return _cout;
	}

	template<>
	struct less<Date*>
	{
		bool operator()(Date* d1, Date* d2)
		{
			return *d1 < *d2;
		}
	};
	/*struct pdcompare_less
	{
		bool operator()(Date* d1, Date* d2)
		{
			return *d1 < *d2;
		}
	};*/

	void test1()
	{
		//priority_queue<int,vector<int>,greater<int>> pq;
		priority_queue<int> pq;
		pq.push(1);
		pq.push(95);
		pq.push(23);
		pq.push(7);
		pq.push(69);

		while (!pq.empty())
		{
			cout << pq.top() << " ";
			pq.pop();
		}
		cout << endl;

		/*std::vector<int> v = { 1, 95, 23, 7, 69 };
		std::priority_queue<int, vector<int>, std::greater<int>> spq(v.begin(), v.end());
		while (!spq.empty())
		{
			cout << spq.top() << " ";
			spq.pop();
		}
		cout << endl;*/
	}

	void test2()
	{
		priority_queue<Date,vector<Date>,greater<Date>> pq;
		pq.push({ 2025,4,12 });
		pq.push({ 2025,3,12 });
		pq.push({ 2025,2,12 });

		while (!pq.empty())
		{
			cout << pq.top() << " ";
			pq.pop();
		}
		cout << endl;

		/*priority_queue<Date*> ppq;
		ppq.push(new Date(2024, 1, 1));
		ppq.push(new Date(2025, 4, 12));
		ppq.push(new Date(2024, 3, 15));

		while (!ppq.empty())
		{
			cout << *ppq.top() << " ";
			ppq.pop();
		}
		cout << endl;*/

		//priority_queue<Date*,vector<Date*>,pdcompare_less> ppq;
		priority_queue<Date*> ppq;
		ppq.push(new Date(2024, 1, 1));
		ppq.push(new Date(2025, 4, 12));
		ppq.push(new Date(2024, 3, 15));

		while (!ppq.empty())
		{
			cout << *ppq.top() << " ";
			ppq.pop();
		}
		cout << endl;
	}

	template<size_t N = 10>
	void test3()
	{
		int a[N] = { 0 };
		for (int i = 0; i < N; i++)
			cout << a[i];
	}

	template<>
	void test3<20>()
	{
		int a[20] = { 0 };
		for (int i = 0; i < 20; i++)
			cout << a[i];
	}


}

int main()
{
	//zkz::test1();
	//zkz::test3<20>();
	/*zkz::Date d(2025, 4, 12);
	zkz::Date* pd = &d;
	cout << *pd << endl;
	zkz::Date*& ppd = pd;
	cout << *ppd << endl;*/
	zkz::test2();
	return 0;
}